<?php
/**
 * Created by PhpStorm.
 * User: hooshim
 * Date: 2014-12-05
 * Time: 오전 5:26
 */
header("Content-Type:text/html;charset=utf-8");
header("Cache-Control:no-cache");
header("Pragma:no-cache");

include_once ($_SERVER['DOCUMENT_ROOT']."/inc/conn.inc.php");
include_once ($_SERVER['DOCUMENT_ROOT']."/inc/function.inc.php"); ##property 파일 인크루드됨.

//## 파라미터 선언
    $findCompany 		= $_POST['findCompany'];
    $compCd 			= $_POST['compCd'];
    $findCompany = iconvEncode($findCompany);


    // Table 이름 선언
    $tbname = "tblCompany";

    $curDt =date("Y-m-d");
    if ($findCompany) {
        $condition .= " AND (companyKR LIKE '%{$findCompany}%' OR companyEN LIKE '%{$findCompany}%') ";
    }
    if($compCd) {
        $condition .= " AND compCd='{$compCd}' ";
    }
    $query = "SELECT companyKR, compCd FROM tblCompany WHERE flag='Y' ".$condition ." ORDER BY companyKR";
    $logger->debug($query ."<br>[#FROM:" . $G_remote_ip."#]"); ## 쿼리 로그 작성
    $result = makeJSONArray($query,$tbname);

    $output = json_encode($result);
    $output = urldecode($output);
    echo iconvDecode($output);
    $logger->debug($_SESSION['BID'] ."//" .$output ."<br>[#FROM:" . $G_remote_ip."#]"); ## 결과 로그 작성
?>